#include "PoseEstimator.h"
#include "Combination.h"
#include <math.h>
#include <limits>
#include <algorithm>
#include <vector>
#include <armadillo>
#include <TooN/TooN.h>
#include <TooN/se3.h>
#include <TooN/SVD.h>
#include <TooN/LU.h>

using namespace TooN;

//TODO: Investigate performance of D. Batra, B. Nabbe, M. Hebert, An alternative formulation for five point relative pose problem. IEEE Workshop on Motion and Video Computing, 2007. (based on regular constrained minimization).

PoseEstimator::PoseEstimator(const ATANCamera &camera)
  : mCamera(camera)
{
}

//Input: Pts_vec0 (3 x 5) & Pts_vec1 (3 x 5) point positions for five corresponding points in image 0 and 1 (calibrated case + unit length vector)
//Output: Evec (9 x 10) - each column is a stacked row essential matrix, num_sols - indicates how many columns of Evec contain valid solutions
/*
void PoseEstimator::fivePointRelative(const std::vector<Observation*> &vObservations0, const std::vector<Observation*> &vObservations1, TooN::Matrix<9,10> &mv9E, int &nNumSolutions)
{
	arma::mat Q(5,9);  
	arma::mat U(9,9);
	arma::colvec s(9);
	arma::mat V(9,9);
	arma::mat T1(10,10);
	arma::mat T2(10,10);	
	arma::mat A(10,10);
	arma::mat M(10,10);
	arma::mat Sols(4,10);

	Q(0,0) = vObservations0[0]->v3Ray[0] * vObservations1[0]->v3Ray[0];
  Q(0,1) = vObservations0[0]->v3Ray[1] * vObservations1[0]->v3Ray[0];
  Q(0,2) = vObservations0[0]->v3Ray[2] * vObservations1[0]->v3Ray[0];
  Q(0,3) = vObservations0[0]->v3Ray[0] * vObservations1[0]->v3Ray[1];
  Q(0,4) = vObservations0[0]->v3Ray[1] * vObservations1[0]->v3Ray[1];
  Q(0,5) = vObservations0[0]->v3Ray[2] * vObservations1[0]->v3Ray[1];
  Q(0,6) = vObservations0[0]->v3Ray[0] * vObservations1[0]->v3Ray[2];
  Q(0,7) = vObservations0[0]->v3Ray[1] * vObservations1[0]->v3Ray[2];
  Q(0,8) = vObservations0[0]->v3Ray[2] * vObservations1[0]->v3Ray[2];
	
	Q(1,0) = vObservations0[1]->v3Ray[0] * vObservations1[1]->v3Ray[0];
  Q(1,1) = vObservations0[1]->v3Ray[1] * vObservations1[1]->v3Ray[0];
  Q(1,2) = vObservations0[1]->v3Ray[2] * vObservations1[1]->v3Ray[0];
  Q(1,3) = vObservations0[1]->v3Ray[0] * vObservations1[1]->v3Ray[1];
  Q(1,4) = vObservations0[1]->v3Ray[1] * vObservations1[1]->v3Ray[1];
  Q(1,5) = vObservations0[1]->v3Ray[2] * vObservations1[1]->v3Ray[1];
  Q(1,6) = vObservations0[1]->v3Ray[0] * vObservations1[1]->v3Ray[2];
  Q(1,7) = vObservations0[1]->v3Ray[1] * vObservations1[1]->v3Ray[2];
  Q(1,8) = vObservations0[1]->v3Ray[2] * vObservations1[1]->v3Ray[2];
	
	Q(2,0) = vObservations0[2]->v3Ray[0] * vObservations1[2]->v3Ray[0];
  Q(2,1) = vObservations0[2]->v3Ray[1] * vObservations1[2]->v3Ray[0];
  Q(2,2) = vObservations0[2]->v3Ray[2] * vObservations1[2]->v3Ray[0];
  Q(2,3) = vObservations0[2]->v3Ray[0] * vObservations1[2]->v3Ray[1];
  Q(2,4) = vObservations0[2]->v3Ray[1] * vObservations1[2]->v3Ray[1];
  Q(2,5) = vObservations0[2]->v3Ray[2] * vObservations1[2]->v3Ray[1];
  Q(2,6) = vObservations0[2]->v3Ray[0] * vObservations1[2]->v3Ray[2];
  Q(2,7) = vObservations0[2]->v3Ray[1] * vObservations1[2]->v3Ray[2];
  Q(2,8) = vObservations0[2]->v3Ray[2] * vObservations1[2]->v3Ray[2];
	
	Q(3,0) = vObservations0[3]->v3Ray[0] * vObservations1[3]->v3Ray[0];
  Q(3,1) = vObservations0[3]->v3Ray[1] * vObservations1[3]->v3Ray[0];
  Q(3,2) = vObservations0[3]->v3Ray[2] * vObservations1[3]->v3Ray[0];
  Q(3,3) = vObservations0[3]->v3Ray[0] * vObservations1[3]->v3Ray[1];
  Q(3,4) = vObservations0[3]->v3Ray[1] * vObservations1[3]->v3Ray[1];
  Q(3,5) = vObservations0[3]->v3Ray[2] * vObservations1[3]->v3Ray[1];
  Q(3,6) = vObservations0[3]->v3Ray[0] * vObservations1[3]->v3Ray[2];
  Q(3,7) = vObservations0[3]->v3Ray[1] * vObservations1[3]->v3Ray[2];
  Q(3,8) = vObservations0[3]->v3Ray[2] * vObservations1[3]->v3Ray[2];
	
	Q(4,0) = vObservations0[4]->v3Ray[0] * vObservations1[4]->v3Ray[0];
  Q(4,1) = vObservations0[4]->v3Ray[1] * vObservations1[4]->v3Ray[0];
  Q(4,2) = vObservations0[4]->v3Ray[2] * vObservations1[4]->v3Ray[0];
  Q(4,3) = vObservations0[4]->v3Ray[0] * vObservations1[4]->v3Ray[1];
  Q(4,4) = vObservations0[4]->v3Ray[1] * vObservations1[4]->v3Ray[1];
  Q(4,5) = vObservations0[4]->v3Ray[2] * vObservations1[4]->v3Ray[1];
  Q(4,6) = vObservations0[4]->v3Ray[0] * vObservations1[4]->v3Ray[2];
  Q(4,7) = vObservations0[4]->v3Ray[1] * vObservations1[4]->v3Ray[2];
  Q(4,8) = vObservations0[4]->v3Ray[2] * vObservations1[4]->v3Ray[2];

	arma::svd(U,s,V,Q);
	arma::mat EE = V.submat(0,5,8,8);

  float EE200,EE210,EE220,EE230,EE240,EE250,EE260,EE270,EE280;
  float EE201,EE211,EE221,EE231,EE241,EE251,EE261,EE271,EE281;
  float EE202,EE212,EE222,EE232,EE242,EE252,EE262,EE272,EE282;
  float EE203,EE213,EE223,EE233,EE243,EE253,EE263,EE273,EE283;

  float EE300,EE310,EE320,EE330,EE340,EE350,EE360,EE370,EE380;
  float EE301,EE311,EE321,EE331,EE341,EE351,EE361,EE371,EE381;
  float EE302,EE312,EE322,EE332,EE342,EE352,EE362,EE372,EE382;
  float EE303,EE313,EE323,EE333,EE343,EE353,EE363,EE373,EE383;

  EE200 =EE(0,0)*EE(0,0);
  EE201 =EE(0,1)*EE(0,1);
  EE202 =EE(0,2)*EE(0,2);
  EE203 =EE(0,3)*EE(0,3);
  EE210 =EE(1,0)*EE(1,0);
  EE211 =EE(1,1)*EE(1,1);
  EE212 =EE(1,2)*EE(1,2);
  EE213 =EE(1,3)*EE(1,3);
  EE220 =EE(2,0)*EE(2,0);
  EE221 =EE(2,1)*EE(2,1);
  EE222 =EE(2,2)*EE(2,2);
  EE223 =EE(2,3)*EE(2,3);
  EE230 =EE(3,0)*EE(3,0);
  EE231 =EE(3,1)*EE(3,1);
  EE232 =EE(3,2)*EE(3,2);
  EE233 =EE(3,3)*EE(3,3);
  EE240 =EE(4,0)*EE(4,0);
  EE241 =EE(4,1)*EE(4,1);
  EE242 =EE(4,2)*EE(4,2);
  EE243 =EE(4,3)*EE(4,3);
  EE250 =EE(5,0)*EE(5,0);
  EE251 =EE(5,1)*EE(5,1);
  EE252 =EE(5,2)*EE(5,2);
  EE253 =EE(5,3)*EE(5,3);
  EE260 =EE(6,0)*EE(6,0);
  EE261 =EE(6,1)*EE(6,1);
  EE262 =EE(6,2)*EE(6,2);
  EE263 =EE(6,3)*EE(6,3);
  EE270 =EE(7,0)*EE(7,0);
  EE271 =EE(7,1)*EE(7,1);
  EE272 =EE(7,2)*EE(7,2);
  EE273 =EE(7,3)*EE(7,3);
  EE280 =EE(8,0)*EE(8,0);
  EE281 =EE(8,1)*EE(8,1);
  EE282 =EE(8,2)*EE(8,2);
  EE283 =EE(8,3)*EE(8,3);

  EE300 =EE(0,0)*EE(0,0)*EE(0,0);
  EE301 =EE(0,1)*EE(0,1)*EE(0,1);
  EE302 =EE(0,2)*EE(0,2)*EE(0,2);
  EE303 =EE(0,3)*EE(0,3)*EE(0,3);
  EE310 =EE(1,0)*EE(1,0)*EE(1,0);
  EE311 =EE(1,1)*EE(1,1)*EE(1,1);
  EE312 =EE(1,2)*EE(1,2)*EE(1,2);
  EE313 =EE(1,3)*EE(1,3)*EE(1,3);
  EE320 =EE(2,0)*EE(2,0)*EE(2,0);
  EE321 =EE(2,1)*EE(2,1)*EE(2,1);
  EE322 =EE(2,2)*EE(2,2)*EE(2,2);
  EE323 =EE(2,3)*EE(2,3)*EE(2,3);
  EE330 =EE(3,0)*EE(3,0)*EE(3,0);
  EE331 =EE(3,1)*EE(3,1)*EE(3,1);
  EE332 =EE(3,2)*EE(3,2)*EE(3,2);
  EE333 =EE(3,3)*EE(3,3)*EE(3,3);
  EE340 =EE(4,0)*EE(4,0)*EE(4,0);
  EE341 =EE(4,1)*EE(4,1)*EE(4,1);
  EE342 =EE(4,2)*EE(4,2)*EE(4,2);
  EE343 =EE(4,3)*EE(4,3)*EE(4,3);
  EE350 =EE(5,0)*EE(5,0)*EE(5,0);
  EE351 =EE(5,1)*EE(5,1)*EE(5,1);
  EE352 =EE(5,2)*EE(5,2)*EE(5,2);
  EE353 =EE(5,3)*EE(5,3)*EE(5,3);
  EE360 =EE(6,0)*EE(6,0)*EE(6,0);
  EE361 =EE(6,1)*EE(6,1)*EE(6,1);
  EE362 =EE(6,2)*EE(6,2)*EE(6,2);
  EE363 =EE(6,3)*EE(6,3)*EE(6,3);
  EE370 =EE(7,0)*EE(7,0)*EE(7,0);
  EE371 =EE(7,1)*EE(7,1)*EE(7,1);
  EE372 =EE(7,2)*EE(7,2)*EE(7,2);
  EE373 =EE(7,3)*EE(7,3)*EE(7,3);
  EE380 =EE(8,0)*EE(8,0)*EE(8,0);
  EE381 =EE(8,1)*EE(8,1)*EE(8,1);
  EE382 =EE(8,2)*EE(8,2)*EE(8,2);
  EE383 =EE(8,3)*EE(8,3)*EE(8,3);

T1(0,0) = 0.5*EE300+0.5*EE(0,0)*EE210+0.5*EE(0,0)*EE220+0.5*EE(0,0)*EE230+EE(3,0)*EE(1,0)*EE(4,0)+EE(3,0)*EE(2,0)*EE(5,0)+0.5*EE(0,0)*EE260+EE(6,0)*EE(1,0)*EE(7,0)+EE(6,0)*EE(2,0)*EE(8,0)-0.5*EE(0,0)*EE240-0.5*EE(0,0)*EE250-0.5*EE(0,0)*EE270-0.5*EE(0,0)*EE280;
T1(0,1) = EE(0,0)*EE(1,1)*EE(1,0)+E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	  

	arma::cx_colvec Eval;
	arma::cx_mat    Evec_right;

	arma::eig_gen(Eval, Evec_right, M);
  
  arma::mat Eval_im = arma::imag(Eval);
	arma::mat Eval_real = arma::real(Eval);
	arma::mat Evec_real = arma::real(Evec_right);
  
  int num_sols = 0;

  for(int i = 0; i < 10; i++)
  {
    if(Eval_im(i) == 0) //is a real eigenvalue
    {
      Sols(0,num_sols) = Evec_real(6,i)/Evec_real(9,i);
      Sols(1,num_sols) = Evec_real(7,i)/Evec_real(9,i);
      Sols(2,num_sols) = Evec_real(8,i)/Evec_real(9,i);
      Sols(3,num_sols) = 1;
      num_sols++;
    }
  }

	if(num_sols > 0)
	{
		arma::mat Valid_Sols = Sols.cols(0,num_sols);
		arma::mat Valid_Evec(4,num_sols);

	  Valid_Evec = EE * Valid_Sols;

		for(int i = 0; i < num_sols; i++)
		{
			arma::colvec Tvec = Valid_Evec.col(i);
			float n = arma::norm(Tvec,2);
			Tvec = Tvec / n;
			
			//copy to output
      mv9E(0,i) = Tvec(0);
      mv9E(1,i) = Tvec(1);
      mv9E(2,i) = Tvec(2);
      mv9E(3,i) = Tvec(3);
      mv9E(4,i) = Tvec(4);
      mv9E(5,i) = Tvec(5);
      mv9E(6,i) = Tvec(6);
      mv9E(7,i) = Tvec(7);
      mv9E(8,i) = Tvec(8);
		}
	}
  
  nNumSolutions = num_sols;    
}
*/

bool PoseEstimator::threeViewRelative(const std::vector<Observation*> &vObservations0, const std::vector<Observation*> &vObservations1, const std::vector<Observation*> &vObservations2, ThreeViewHypothesis &hyp)
{
  bool bSolution = false;
  int nNumEvecs;
  Matrix<9,10> mv9E20;

  hyp.dError = std::numeric_limits<double>::max();

  //fivePointRelative(vObservations0, vObservations2, mv9E20, nNumEvecs); //Relative pose of views 0 and 2

  for(int sol = 0; sol < nNumEvecs; sol++)
  {
    Matrix<9,1> m91E20 = mv9E20.slice(0,sol,9,1);
    Matrix<3,3> m33E20;
    evecToMat(m91E20, m33E20);
  
    SE3<> se3T20;
    extractRt(m33E20, vObservations0[0], vObservations2[0], se3T20);

    //Triangulate the remaining four points (first one done in extractRt)
    for(int i = 1; i < 5; i++)
      vObservations0[i]->v3CamPos = ReprojectPoint(se3T20, mCamera.UnProject(vObservations2[i]->v2ImagePos), mCamera.UnProject(vObservations0[i]->v2ImagePos));

    // vObservations0 contains triangulated points (in cam0 frame), set these as the world coodinates for all frames...
    for(int i = 0; i < 5; i++)
      vObservations2[i]->v3CamPos = vObservations1[i]->v3CamPos = vObservations0[i]->v3CamPos;

    PoseHypothesis h3p;
  	bool three_pt_soln = threePointAbsolute(vObservations1, h3p, true); // Peform 3pt absolute pose estimation relative to triangulated points in first frame

    //Compute reprojection error for all 5 points in all 3 views
  	if(three_pt_soln)
  	{
      double dError = 0.0;
      for(unsigned int i = 0; i < 5; i++)
      {
        dError += squaredProjectionError(SE3<>(), vObservations0[i]->v3CamPos, vObservations0[i]->v2ImagePos);
        dError += squaredProjectionError(h3p.se3CfromW, vObservations1[i]->v3CamPos, vObservations1[i]->v2ImagePos);
        dError += squaredProjectionError(se3T20, vObservations2[i]->v3CamPos, vObservations2[i]->v2ImagePos);
      }

      if(dError < hyp.dError)
      {
        bSolution = true;
        hyp.dError = dError;
        hyp.m33E20 = m33E20;
        hyp.se3T20 = se3T20;
        hyp.se3T10 = h3p.se3CfromW;
      }
	  }
  }

  return bSolution;
}


bool PoseEstimator::threeViewRelativeRANSAC(const unsigned int nNumHypo, const unsigned int nNumBlocks, const unsigned int nBlockSize, const std::vector<Observation*> &vObservations0, const std::vector<Observation*> &vObservations1, const std::vector<Observation*> &vObservations2, ThreeViewHypothesis &bestHypothesis)
{
  unsigned int nNumObs = vObservations0.size();
  Combinations *comb = new Combinations(nNumObs, 5);
  unsigned long int nNumComb = comb->numCombinations();
  bool bSolution = false;
  int hyp_ind[5];
  std::vector<Observation*> vHypothesisObservations0(5), vHypothesisObservations1(5), vHypothesisObservations2(5);

  if(nNumComb < 2)
    bSolution = false;
  else
  {
		std::vector<ThreeViewHypothesis> hypotheses;

	  //Generate all hypotheses first
    if(nNumHypo > nNumComb)
    {
      hypotheses.reserve(nNumComb);

      for(unsigned long int i = 0; i < nNumComb; i++)
      {
        comb->nextCombination(hyp_ind);

        vHypothesisObservations0[0] = vObservations0[hyp_ind[0]];
        vHypothesisObservations0[1] = vObservations0[hyp_ind[1]];
        vHypothesisObservations0[2] = vObservations0[hyp_ind[2]];
        vHypothesisObservations0[3] = vObservations0[hyp_ind[3]];
        vHypothesisObservations0[4] = vObservations0[hyp_ind[4]];
        vHypothesisObservations1[0] = vObservations1[hyp_ind[0]];
        vHypothesisObservations1[1] = vObservations1[hyp_ind[1]];
        vHypothesisObservations1[2] = vObservations1[hyp_ind[2]];
        vHypothesisObservations1[3] = vObservations1[hyp_ind[3]];
        vHypothesisObservations1[4] = vObservations1[hyp_ind[4]];
        vHypothesisObservations2[0] = vObservations2[hyp_ind[0]];
        vHypothesisObservations2[1] = vObservations2[hyp_ind[1]];
        vHypothesisObservations2[2] = vObservations2[hyp_ind[2]];
        vHypothesisObservations2[3] = vObservations2[hyp_ind[3]];
        vHypothesisObservations2[4] = vObservations2[hyp_ind[4]];

		    ThreeViewHypothesis h;

        bool bValid = threeViewRelative(vHypothesisObservations0, vHypothesisObservations1, vHypothesisObservations2, h);
        if(bValid)
        {
          h.computeTrifocalTensor();
          h.dError = 0.0; // In the following part we will use trifocal sampson error rather than reprojection error..
          h.nErrorPoints = 0;
	        hypotheses.push_back(h);
        }
      }
    }
    else
    {
      hypotheses.reserve(nNumHypo);

	    for(unsigned int i = 0; i < nNumHypo; ++i)
	    {
		    //Randomly (for now) select four unique points (later may bias to prefer points further apart)
		    for(unsigned int req = 5, s = 0; req > 0; --req)
        {
		      //Select unique observations like drawing tickets from a lottery. Equal chance of winning (N/M), but each time a non-winning ticket is drawn
		      //probability changes to N/(M-1) and each time winning ticket drawn probability changes to (N-1)/(M-1)
          while((rand() % (nNumObs-s)) >= req){ s++; }
          vHypothesisObservations0[req-1] = vObservations0[s];
          vHypothesisObservations1[req-1] = vObservations1[s];
          vHypothesisObservations2[req-1] = vObservations2[s];
          s++;
        }

	    	ThreeViewHypothesis h;
	    	bool bValid = threeViewRelative(vHypothesisObservations0, vHypothesisObservations1, vHypothesisObservations2, h);
        if(bValid)
        {
          h.computeTrifocalTensor();
          h.dError = 0.0; // In the following part we will use trifocal sampson error rather than cauchy error..
          h.nErrorPoints = 0;
	        hypotheses.push_back(h);
        }
	    }
    }

    unsigned int start_index = 0, preemptive_reduction = hypotheses.size(), sample_count = 0, block_count = 0;
    unsigned int total_score = nNumBlocks*nBlockSize;
    while(1)
    {
      // Select test observations first
      Observation *pObservation0, *pObservation1, *pObservation2;
      if(total_score > nNumObs)
      {
        pObservation0 = vObservations0[start_index];
        pObservation1 = vObservations1[start_index];
        pObservation2 = vObservations2[start_index];
        start_index++;
      }
      else
      {
        while((rand() % (nNumObs-start_index)) >= 1){ start_index++; }
        pObservation0 = vObservations0[start_index];
        pObservation1 = vObservations1[start_index];
        pObservation2 = vObservations2[start_index];
        start_index++;
      }

		  for(unsigned int hypo = 0; hypo < preemptive_reduction; hypo++)
      {
        hypotheses[hypo].dError += computeTrifocalSampsonError(hypotheses[hypo], pObservation0, pObservation1, pObservation2);
        hypotheses[hypo].nErrorPoints++;
      }
      sample_count++;

      // If we have run out of observations to process sort according to current score and return
      if(start_index == nNumObs)
      {
        std::partial_sort(hypotheses.begin(), hypotheses.begin()+1, hypotheses.end());
        break;
      }
      else if(sample_count == nBlockSize) // Preemptive iteration
      {
        sample_count = 0;
        block_count++;

			  //Reorder the hypotheses according to there scores and reduce the number of hypotheses
			  preemptive_reduction = floor(preemptive_reduction/2);

			  std::partial_sort(hypotheses.begin(), hypotheses.begin()+preemptive_reduction, hypotheses.end());

        // Check we have more than one hypothesis remaining
        if(preemptive_reduction == 1 || block_count == nNumBlocks)
          break;

 			  hypotheses.erase(hypotheses.begin()+preemptive_reduction, hypotheses.end());
      }
	  }

    if(!hypotheses.empty())
    {
	    bestHypothesis = hypotheses[0];
      if(isnan(bestHypothesis.dError))
        bSolution = false;
      else
      	bSolution = true;

      hypotheses.clear();
    }
  }

  delete comb;
  return bSolution;
}


Vector<3> PoseEstimator::ReprojectPoint(SE3<> se3AfromB, const Vector<2> &v2A, const Vector<2> &v2B)
{
  Matrix<3,4> PDash;
  PDash.slice<0,0,3,3>() = se3AfromB.get_rotation().get_matrix();
  PDash.slice<0,3,3,1>() = se3AfromB.get_translation().as_col();
  
  Matrix<4> A;
  A[0][0] = -1.0; A[0][1] =  0.0; A[0][2] = v2B[0]; A[0][3] = 0.0;
  A[1][0] =  0.0; A[1][1] = -1.0; A[1][2] = v2B[1]; A[1][3] = 0.0;
  A[2] = v2A[0] * PDash[2] - PDash[0];
  A[3] = v2A[1] * PDash[2] - PDash[1];

  SVD<4,4> svd(A);
  Vector<4> v4Smallest = svd.get_VT()[3];
  if(v4Smallest[3] == 0.0)
    v4Smallest[3] = 0.00001;
  return project(v4Smallest);
}


void PoseEstimator::extractRt(const TooN::Matrix<3,3> &m33E10, Observation* pObs0, const Observation* pObs1, TooN::SE3<> &se3T10)
{
  Matrix<3,3> m33EET = m33E10 * m33E10.T();
  double dTrace = m33EET(0,0) + m33EET(1,1) + m33EET(2,2);
  Matrix<3,3> m33BBT = ((0.5 * dTrace)*Identity(3)) - m33EET;

  Vector<3> v3Ti;  
  if(m33BBT(0,0) > std::max(m33BBT(1,1), m33BBT(2,2)))
  {
    double den = sqrt(m33BBT(0,0));
    v3Ti[0] = m33BBT(0,0) / den;
    v3Ti[1] = m33BBT(0,1) / den;
    v3Ti[2] = m33BBT(0,2) / den;
  }
  else if(m33BBT(1,1) > m33BBT(2,2))
  {
    double den = sqrt(m33BBT(1,1));
    v3Ti[0] = m33BBT(1,0) / den;
    v3Ti[1] = m33BBT(1,1) / den;
    v3Ti[2] = m33BBT(1,2) / den;  
  }
  else
  {
    double den = sqrt(m33BBT(2,2));
    v3Ti[0] = m33BBT(2,0) / den;
    v3Ti[1] = m33BBT(2,1) / den;
    v3Ti[2] = m33BBT(2,2) / den;  
  }

  double scale = (v3Ti * v3Ti);

  Matrix<3,3> m33Ri;
  m33Ri(0,0) = ((m33E10(1,1)*m33E10(2,2)-m33E10(1,2)*m33E10(2,1))+v3Ti[2]*m33E10(1,0)-v3Ti[1]*m33E10(2,0))/scale;
  m33Ri(0,1) = ((m33E10(1,2)*m33E10(2,0)-m33E10(1,0)*m33E10(2,2))+v3Ti[2]*m33E10(1,1)-v3Ti[1]*m33E10(2,1))/scale;
  m33Ri(0,2) = ((m33E10(1,0)*m33E10(2,1)-m33E10(1,1)*m33E10(2,0))+v3Ti[2]*m33E10(1,2)-v3Ti[1]*m33E10(2,2))/scale;
  m33Ri(1,0) = ((m33E10(2,1)*m33E10(0,2)-m33E10(2,2)*m33E10(0,1))-v3Ti[2]*m33E10(0,0)+v3Ti[0]*m33E10(2,0))/scale;
  m33Ri(1,1) = ((m33E10(2,2)*m33E10(0,0)-m33E10(2,0)*m33E10(0,2))-v3Ti[2]*m33E10(0,1)+v3Ti[0]*m33E10(2,1))/scale;
  m33Ri(1,2) = ((m33E10(2,0)*m33E10(0,1)-m33E10(2,1)*m33E10(0,0))-v3Ti[2]*m33E10(0,2)+v3Ti[0]*m33E10(2,2))/scale;
  m33Ri(2,0) = ((m33E10(0,1)*m33E10(1,2)-m33E10(0,2)*m33E10(1,1))+v3Ti[1]*m33E10(0,0)-v3Ti[0]*m33E10(1,0))/scale;
  m33Ri(2,1) = ((m33E10(0,2)*m33E10(1,0)-m33E10(0,0)*m33E10(1,2))+v3Ti[1]*m33E10(0,1)-v3Ti[0]*m33E10(1,1))/scale;
  m33Ri(2,2) = ((m33E10(0,0)*m33E10(1,1)-m33E10(0,1)*m33E10(1,0))+v3Ti[1]*m33E10(0,2)-v3Ti[0]*m33E10(1,2))/scale;

  //Triangulate point position to test cheriality
  SE3<> se3Test10 = SE3<>(m33Ri, v3Ti);
  Vector<3> v3CamPt = ReprojectPoint(se3Test10, mCamera.UnProject(pObs1->v2ImagePos), mCamera.UnProject(pObs0->v2ImagePos));

  double c1 = v3CamPt[2]; //Q_3
  double c2 = m33Ri(2,0)*v3CamPt[0] + m33Ri(2,1)*v3CamPt[1] + m33Ri(2,2)*v3CamPt[2] + v3Ti[2]; //([ri|t]*Q)_3

  if(c1 > 0 && c2 > 0) //In front of both cameras
  {
    se3T10.get_rotation() = m33Ri;
    se3T10.get_translation() = v3Ti;
    pObs0->v3CamPos = v3CamPt;
  }
  else if(c1 < 0 && c2 < 0) //Behind both cameras
  {
    se3T10.get_rotation() = m33Ri;
    se3T10.get_translation() = -v3Ti;
    pObs0->v3CamPos = -v3CamPt;
  }
  else //Twisted pair
  {
    Matrix<3,3> m33F;
    m33F(0,0) = (2*m33BBT(0,0) - scale)/scale;
    m33F(0,1) = 2*m33BBT(0,1)/scale;
    m33F(0,2) = 2*m33BBT(0,2)/scale;
    m33F(1,0) = 2*m33BBT(1,0)/scale;
    m33F(1,1) = (2*m33BBT(1,1) - scale)/scale;
    m33F(1,2) = 2*m33BBT(1,2)/scale;
    m33F(2,0) = 2*m33BBT(2,0)/scale;
    m33F(2,1) = 2*m33BBT(2,1)/scale;
    m33F(2,2) = (2*m33BBT(2,2) - scale)/scale;
    m33Ri = m33F * m33Ri;

    //Re-triangulate with new R
    se3Test10 = SE3<>(m33Ri, v3Ti);
    v3CamPt = ReprojectPoint(se3Test10, mCamera.UnProject(pObs1->v2ImagePos), mCamera.UnProject(pObs0->v2ImagePos));

    double c3 = v3CamPt[2];
    double c4 = m33Ri(2,0)*v3CamPt[0] + m33Ri(2,1)*v3CamPt[1] + m33Ri(2,2)*v3CamPt[2] + v3Ti[2]; //([ri|t]*Q)_3

    if(c3 > 0 && c4 > 0) //Behind 2nd camera in front of first
    {
      se3T10.get_rotation() = m33Ri;
      se3T10.get_translation() = v3Ti;
      pObs0->v3CamPos = v3CamPt;
    }
    else
    {
      se3T10.get_rotation() = m33Ri;
      se3T10.get_translation() = -v3Ti;
      pObs0->v3CamPos = -v3CamPt;
    }
  }
}

//Input: E20 (3 x 3) - essential matrix describing relative pose of frame 0 and 2, Tf210 (3 x 3 x 3) the trifocal tensor for views 0,1,2
//Input: Pt_vec0 (3 x 1),Pt_vec1 (3 x 1) & Pt_vec2 (3 x 1) point position for corresponding point in image 0, 1 and 2 (calibrated case + unit length vector)
//Ouput: Trifocal sampson error (minimum image pertubation required to bring the triplet of points to trifocal incidence)
double PoseEstimator::computeTrifocalSampsonError(const ThreeViewHypothesis &hyp, const Observation* pObs0, const Observation* pObs1, const Observation* pObs2)
{
  //vector components in homogeneous form
  double a0 = pObs0->v3Ray[0]/pObs0->v3Ray[2];
  double a1 = pObs0->v3Ray[1]/pObs0->v3Ray[2];
  double a2 = 1;
  double b0 = pObs1->v3Ray[0]/pObs1->v3Ray[2];
  double b1 = pObs1->v3Ray[1]/pObs1->v3Ray[2];
  //double b2 = 1; not required
  double c0 = pObs2->v3Ray[0]/pObs2->v3Ray[2];
  double c1 = pObs2->v3Ray[1]/pObs2->v3Ray[2];
  double c2 = 1;

  double e00 = hyp.m33E20(0,0);
  double e01 = hyp.m33E20(0,1);
  double e02 = hyp.m33E20(0,2);
  double e10 = hyp.m33E20(1,0);
  double e11 = hyp.m33E20(1,1);
  double e12 = hyp.m33E20(1,2);
  double e20 = hyp.m33E20(2,0);
  double e21 = hyp.m33E20(2,1);
  double e22 = hyp.m33E20(2,2);

  double t000 = hyp.m33Tf0(0,0);
  double t010 = hyp.m33Tf0(0,1);
  double t020 = hyp.m33Tf0(0,2);
  double t100 = hyp.m33Tf0(1,0);
  double t110 = hyp.m33Tf0(1,1);
  double t120 = hyp.m33Tf0(1,2);
  double t200 = hyp.m33Tf0(2,0);
  double t210 = hyp.m33Tf0(2,1);
  double t220 = hyp.m33Tf0(2,2);

  double t001 = hyp.m33Tf1(0,0);
  double t011 = hyp.m33Tf1(0,1);
  double t021 = hyp.m33Tf1(0,2);
  double t101 = hyp.m33Tf1(1,0);
  double t111 = hyp.m33Tf1(1,1);
  double t121 = hyp.m33Tf1(1,2);
  double t201 = hyp.m33Tf1(2,0);
  double t211 = hyp.m33Tf1(2,1);
  double t221 = hyp.m33Tf1(2,2);

  double t002 = hyp.m33Tf2(0,0);
  double t012 = hyp.m33Tf2(0,1);
  double t022 = hyp.m33Tf2(0,2);
  double t102 = hyp.m33Tf2(1,0);
  double t112 = hyp.m33Tf2(1,1);
  double t122 = hyp.m33Tf2(1,2);
  double t202 = hyp.m33Tf2(2,0);
  double t212 = hyp.m33Tf2(2,1);
  double t222 = hyp.m33Tf2(2,2);

  Vector<3> v3G;
  v3G[0] = (c0*e00+c1*e10+c2*e20)*a0+(c0*e01+c1*e11+c2*e21)*a1+(c0*e02+c1*e12+c2*e22)*a2;

  v3G[1] = a0*(-c2*(e10*a0+e11*a1+e12*a2)*t010+c2*(e00*a0+e01*a1+e02*a2)*t011+(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t012+b1*c2*(e10*a0+e11*a1+e12*a2)*t020-b1*c2*(e00*a0+e01*a1+e02*a2)*t021-b1*(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t022)+a1*(-c2*(e10*a0+e11*a1+e12*a2)*t110+c2*(e00*a0+e01*a1+e02*a2)*t111+(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t112+b1*c2*(e10*a0+e11*a1+e12*a2)*t120-b1*c2*(e00*a0+e01*a1+e02*a2)*t121-b1*(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t122)+a2*(-c2*(e10*a0+e11*a1+e12*a2)*t210+c2*(e00*a0+e01*a1+e02*a2)*t211+(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t212+b1*c2*(e10*a0+e11*a1+e12*a2)*t220-b1*c2*(e00*a0+e01*a1+e02*a2)*t221-b1*(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t222);

  v3G[2] = a0*(-c2*(e10*a0+e11*a1+e12*a2)*t000+c2*(e00*a0+e01*a1+e02*a2)*t001+(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t002+b0*c2*(e10*a0+e11*a1+e12*a2)*t020-b0*c2*(e00*a0+e01*a1+e02*a2)*t021-b0*(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t022)+a1*(-c2*(e10*a0+e11*a1+e12*a2)*t100+c2*(e00*a0+e01*a1+e02*a2)*t101+(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t102+b0*c2*(e10*a0+e11*a1+e12*a2)*t120-b0*c2*(e00*a0+e01*a1+e02*a2)*t121-b0*(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t122)+a2*(-c2*(e10*a0+e11*a1+e12*a2)*t200+c2*(e00*a0+e01*a1+e02*a2)*t201+(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t202+b0*c2*(e10*a0+e11*a1+e12*a2)*t220-b0*c2*(e00*a0+e01*a1+e02*a2)*t221-b0*(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t222);
  
  Matrix<3,6> m36J;
  m36J(0,0) = c0*e00+c1*e10+c2*e20;
  m36J(0,1) = c0*e01+c1*e11+c2*e21;
  m36J(0,2) = 0;
  m36J(0,3) = 0;
  m36J(0,4) = e00*a0+e01*a1+e02*a2;
  m36J(0,5) = e10*a0+e11*a1+e12*a2;

  m36J(1,0) = -c2*(e10*a0+e11*a1+e12*a2)*t010+c2*(e00*a0+e01*a1+e02*a2)*t011+(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t012+b1*c2*(e10*a0+e11*a1+e12*a2)*t020-b1*c2*(e00*a0+e01*a1+e02*a2)*t021-b1*(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t022+a0*(-c2*e10*t010+c2*e00*t011+(c0*e10-c1*e00)*t012+b1*c2*e10*t020-b1*c2*e00*t021-b1*(c0*e10-c1*e00)*t022)+a1*(-c2*e10*t110+c2*e00*t111+(c0*e10-c1*e00)*t112+b1*c2*e10*t120-b1*c2*e00*t121-b1*(c0*e10-c1*e00)*t122)+a2*(-c2*e10*t210+c2*e00*t211+(c0*e10-c1*e00)*t212+b1*c2*e10*t220-b1*c2*e00*t221-b1*(c0*e10-c1*e00)*t222);
  m36J(1,1) = a0*(-c2*e11*t010+c2*e01*t011+(c0*e11-c1*e01)*t012+b1*c2*e11*t020-b1*c2*e01*t021-b1*(c0*e11-c1*e01)*t022)-c2*(e10*a0+e11*a1+e12*a2)*t110+c2*(e00*a0+e01*a1+e02*a2)*t111+(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t112+b1*c2*(e10*a0+e11*a1+e12*a2)*t120-b1*c2*(e00*a0+e01*a1+e02*a2)*t121-b1*(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t122+a1*(-c2*e11*t110+c2*e01*t111+(c0*e11-c1*e01)*t112+b1*c2*e11*t120-b1*c2*e01*t121-b1*(c0*e11-c1*e01)*t122)+a2*(-c2*e11*t210+c2*e01*t211+(c0*e11-c1*e01)*t212+b1*c2*e11*t220-b1*c2*e01*t221-b1*(c0*e11-c1*e01)*t222);
  m36J(1,2) = 0;
  m36J(1,3) = a0*(c2*(e10*a0+e11*a1+e12*a2)*t020-c2*(e00*a0+e01*a1+e02*a2)*t021-(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t022)+a1*(c2*(e10*a0+e11*a1+e12*a2)*t120-c2*(e00*a0+e01*a1+e02*a2)*t121-(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t122)+a2*(c2*(e10*a0+e11*a1+e12*a2)*t220-c2*(e00*a0+e01*a1+e02*a2)*t221-(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t222);
  m36J(1,4) = a0*((e10*a0+e11*a1+e12*a2)*t012-b1*(e10*a0+e11*a1+e12*a2)*t022)+a1*((e10*a0+e11*a1+e12*a2)*t112-b1*(e10*a0+e11*a1+e12*a2)*t122)+a2*((e10*a0+e11*a1+e12*a2)*t212-b1*(e10*a0+e11*a1+e12*a2)*t222);
  m36J(1,5) = a0*((-e00*a0-e01*a1-e02*a2)*t012-b1*(-e00*a0-e01*a1-e02*a2)*t022)+a1*((-e00*a0-e01*a1-e02*a2)*t112-b1*(-e00*a0-e01*a1-e02*a2)*t122)+a2*((-e00*a0-e01*a1-e02*a2)*t212-b1*(-e00*a0-e01*a1-e02*a2)*t222);

  m36J(2,0) = -c2*(e10*a0+e11*a1+e12*a2)*t000+c2*(e00*a0+e01*a1+e02*a2)*t001+(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t002+b0*c2*(e10*a0+e11*a1+e12*a2)*t020-b0*c2*(e00*a0+e01*a1+e02*a2)*t021-b0*(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t022+a0*(-c2*e10*t000+c2*e00*t001+(c0*e10-c1*e00)*t002+b0*c2*e10*t020-b0*c2*e00*t021-b0*(c0*e10-c1*e00)*t022)+a1*(-c2*e10*t100+c2*e00*t101+(c0*e10-c1*e00)*t102+b0*c2*e10*t120-b0*c2*e00*t121-b0*(c0*e10-c1*e00)*t122)+a2*(-c2*e10*t200+c2*e00*t201+(c0*e10-c1*e00)*t202+b0*c2*e10*t220-b0*c2*e00*t221-b0*(c0*e10-c1*e00)*t222);
  m36J(2,1) = a0*(-c2*e11*t000+c2*e01*t001+(c0*e11-c1*e01)*t002+b0*c2*e11*t020-b0*c2*e01*t021-b0*(c0*e11-c1*e01)*t022)-c2*(e10*a0+e11*a1+e12*a2)*t100+c2*(e00*a0+e01*a1+e02*a2)*t101+(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t102+b0*c2*(e10*a0+e11*a1+e12*a2)*t120-b0*c2*(e00*a0+e01*a1+e02*a2)*t121-b0*(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t122+a1*(-c2*e11*t100+c2*e01*t101+(c0*e11-c1*e01)*t102+b0*c2*e11*t120-b0*c2*e01*t121-b0*(c0*e11-c1*e01)*t122)+a2*(-c2*e11*t200+c2*e01*t201+(c0*e11-c1*e01)*t202+b0*c2*e11*t220-b0*c2*e01*t221-b0*(c0*e11-c1*e01)*t222);
  m36J(2,2) = a0*(c2*(e10*a0+e11*a1+e12*a2)*t020-c2*(e00*a0+e01*a1+e02*a2)*t021-(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t022)+a1*(c2*(e10*a0+e11*a1+e12*a2)*t120-c2*(e00*a0+e01*a1+e02*a2)*t121-(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t122)+a2*(c2*(e10*a0+e11*a1+e12*a2)*t220-c2*(e00*a0+e01*a1+e02*a2)*t221-(c0*(e10*a0+e11*a1+e12*a2)-c1*(e00*a0+e01*a1+e02*a2))*t222);
  m36J(2,3) = 0;
  m36J(2,4) = a0*((e10*a0+e11*a1+e12*a2)*t002-b0*(e10*a0+e11*a1+e12*a2)*t022)+a1*((e10*a0+e11*a1+e12*a2)*t102-b0*(e10*a0+e11*a1+e12*a2)*t122)+a2*((e10*a0+e11*a1+e12*a2)*t202-b0*(e10*a0+e11*a1+e12*a2)*t222);
  m36J(2,5) = a0*((-e00*a0-e01*a1-e02*a2)*t002-b0*(-e00*a0-e01*a1-e02*a2)*t022)+a1*((-e00*a0-e01*a1-e02*a2)*t102-b0*(-e00*a0-e01*a1-e02*a2)*t122)+a2*((-e00*a0-e01*a1-e02*a2)*t202-b0*(-e00*a0-e01*a1-e02*a2)*t222);

  Matrix<3,3> m33JJT = m36J * m36J.T();

  // create the LU decomposition of m33JJT
  LU<3> luJJT(m33JJT);

  return v3G * luJJT.backsub(v3G);
}


void PoseEstimator::evecToMat(const Matrix<9,1> &m91E, TooN::Matrix<3,3> &m33E)
{
  m33E(0,0) = m91E(0,0);
  m33E(0,1) = m91E(1,0);
  m33E(0,2) = m91E(2,0);
  m33E(1,0) = m91E(3,0);
  m33E(1,1) = m91E(4,0);
  m33E(1,2) = m91E(5,0);
  m33E(2,0) = m91E(6,0);
  m33E(2,1) = m91E(7,0);
  m33E(2,2) = m91E(8,0);
}

bool PoseEstimator::threePointAbsoluteRANSAC(const unsigned int nNumHypo, const unsigned int nNumBlocks, const unsigned int nGroupsPerBlock, const unsigned int nGroupSize, const std::vector<Observation*> &vObservations, PoseHypothesis &bestPose, InitialPoseHypothesis *pInitialPose)
{
  unsigned int nNumObs = vObservations.size();
  Combinations *comb = new Combinations(nNumObs, 4);
  unsigned long int nNumComb = comb->numCombinations();    
  bool bSolution = false;
  int hyp_ind[4];
  std::vector<Observation*> vHypothesisObservations(4);
  SE3<> se3HypothesisPose;

  if(nNumComb < 2)
    bSolution = false;
  else
  {
	  std::vector<PoseHypothesis> hypotheses;

	  //Generate all hypotheses first
    if(nNumHypo > nNumComb)
    {
      hypotheses.reserve(nNumComb);

      for(unsigned long int i = 0; i < nNumComb; i++)
      {
        comb->nextCombination(hyp_ind);

        // Ensure only one observation of each world/image point otherwise cannot result in a valid hypothesis
        vHypothesisObservations[0] = vObservations[hyp_ind[0]];
        vHypothesisObservations[1] = vObservations[hyp_ind[1]];
        if(vHypothesisObservations[1]->v3WorldPos == vHypothesisObservations[0]->v3WorldPos ||
            vHypothesisObservations[1]->v2ImagePos == vHypothesisObservations[0]->v2ImagePos)
          continue;
        vHypothesisObservations[2] = vObservations[hyp_ind[2]];
        if(vHypothesisObservations[2]->v3WorldPos == vHypothesisObservations[1]->v3WorldPos ||
            vHypothesisObservations[2]->v2ImagePos == vHypothesisObservations[1]->v2ImagePos ||  
            vHypothesisObservations[2]->v3WorldPos == vHypothesisObservations[0]->v3WorldPos ||
            vHypothesisObservations[2]->v2ImagePos == vHypothesisObservations[0]->v2ImagePos)
          continue;
        vHypothesisObservations[3] = vObservations[hyp_ind[3]];
        if(vHypothesisObservations[3]->v3WorldPos == vHypothesisObservations[2]->v3WorldPos ||
            vHypothesisObservations[3]->v2ImagePos == vHypothesisObservations[2]->v2ImagePos ||
            vHypothesisObservations[3]->v3WorldPos == vHypothesisObservations[1]->v3WorldPos ||
            vHypothesisObservations[3]->v2ImagePos == vHypothesisObservations[1]->v2ImagePos ||    
            vHypothesisObservations[3]->v3WorldPos == vHypothesisObservations[0]->v3WorldPos ||
            vHypothesisObservations[3]->v2ImagePos == vHypothesisObservations[0]->v2ImagePos)
          continue;

        // Ensure first three points are not (almost) colinear and too close together as will not result in a good hypothesis
        double d21 = sqrt(pow(vHypothesisObservations[2]->v2ImagePos[0] - vHypothesisObservations[1]->v2ImagePos[0], 2) + 
                          pow(vHypothesisObservations[2]->v2ImagePos[1] - vHypothesisObservations[1]->v2ImagePos[1], 2));
        double d0perp21 = abs((vHypothesisObservations[2]->v2ImagePos[0]-vHypothesisObservations[1]->v2ImagePos[0]) * 
                              (vHypothesisObservations[1]->v2ImagePos[1]-vHypothesisObservations[0]->v2ImagePos[1]) - 
                              (vHypothesisObservations[1]->v2ImagePos[0]-vHypothesisObservations[0]->v2ImagePos[0]) * 
                              (vHypothesisObservations[2]->v2ImagePos[1]-vHypothesisObservations[1]->v2ImagePos[1]))/d21;
        if(d21 < 3.0 || d0perp21 < 3.0 || std::min(d21, d0perp21)/std::max(d21, d0perp21) < 0.1)
          continue;

        PoseHypothesis h;
        bool bValid = threePointAbsolute(vHypothesisObservations, h);
        if(bValid)
        {
          if(pInitialPose != NULL)
          {
            if(pInitialPose->dMaxPositionError > 0.0 && norm(pInitialPose->se3WfromC.get_translation() - h.se3CfromW.inverse().get_translation()) > pInitialPose->dMaxPositionError)
              continue;
            if(pInitialPose->dMaxRotationError > 0.0 && norm((h.se3CfromW.get_rotation()*pInitialPose->se3WfromC.get_rotation()).ln()) > pInitialPose->dMaxRotationError)
              continue;
          }
 		      hypotheses.push_back(h);
        }
      }

    }
    else
    {
      hypotheses.reserve(nNumHypo);

	    for(unsigned int i = 0; i < nNumHypo; ++i)
	    {
		    //Randomly (for now) select four unique points (later may bias to prefer points further apart)
		    for(unsigned int req = 4, s = 0; req > 0; --req)
        {
		      //Select unique observations like drawing tickets from a lottery. Equal chance of winning (N/M), but each time a non-winning ticket is drawn
		      //probability changes to N/(M-1) and each time winning ticket drawn probability changes to (N-1)/(M-1)
          while((rand() % (nNumObs-s)) >= req){ s++; }
          vHypothesisObservations[req-1] = vObservations[s++];
        }

        // Ensure only one observation of each world/image point otherwise cannot result in a valid hypothesis
        if(vHypothesisObservations[1]->v3WorldPos == vHypothesisObservations[0]->v3WorldPos ||
            vHypothesisObservations[1]->v2ImagePos == vHypothesisObservations[0]->v2ImagePos ||
            vHypothesisObservations[2]->v3WorldPos == vHypothesisObservations[1]->v3WorldPos ||
            vHypothesisObservations[2]->v2ImagePos == vHypothesisObservations[1]->v2ImagePos ||  
            vHypothesisObservations[2]->v3WorldPos == vHypothesisObservations[0]->v3WorldPos ||
            vHypothesisObservations[2]->v2ImagePos == vHypothesisObservations[0]->v2ImagePos ||
            vHypothesisObservations[3]->v3WorldPos == vHypothesisObservations[2]->v3WorldPos ||
            vHypothesisObservations[3]->v2ImagePos == vHypothesisObservations[2]->v2ImagePos ||
            vHypothesisObservations[3]->v3WorldPos == vHypothesisObservations[1]->v3WorldPos ||
            vHypothesisObservations[3]->v2ImagePos == vHypothesisObservations[1]->v2ImagePos ||    
            vHypothesisObservations[3]->v3WorldPos == vHypothesisObservations[0]->v3WorldPos ||
            vHypothesisObservations[3]->v2ImagePos == vHypothesisObservations[0]->v2ImagePos)
          continue;

        // Ensure first three points are not (almost) colinear and too close together as will not result in a good hypothesis
        double d21 = sqrt(pow(vHypothesisObservations[2]->v2ImagePos[0] - vHypothesisObservations[1]->v2ImagePos[0], 2) + 
                          pow(vHypothesisObservations[2]->v2ImagePos[1] - vHypothesisObservations[1]->v2ImagePos[1], 2));
        double d0perp21 = abs((vHypothesisObservations[2]->v2ImagePos[0]-vHypothesisObservations[1]->v2ImagePos[0]) * 
                              (vHypothesisObservations[1]->v2ImagePos[1]-vHypothesisObservations[0]->v2ImagePos[1]) - 
                              (vHypothesisObservations[1]->v2ImagePos[0]-vHypothesisObservations[0]->v2ImagePos[0]) * 
                              (vHypothesisObservations[2]->v2ImagePos[1]-vHypothesisObservations[1]->v2ImagePos[1]))/d21;
        if(d21 < 3.0 || d0perp21 < 3.0 || std::min(d21, d0perp21)/std::max(d21, d0perp21) < 0.1)
          continue;

        PoseHypothesis h;
        bool bValid = threePointAbsolute(vHypothesisObservations, h);
        if(bValid)
        {
          if(pInitialPose != NULL)
          {
            if(pInitialPose->dMaxPositionError > 0.0 && norm(pInitialPose->se3WfromC.get_translation() - h.se3CfromW.inverse().get_translation()) > pInitialPose->dMaxPositionError)
              continue;
            if(pInitialPose->dMaxRotationError > 0.0 && norm((h.se3CfromW.get_rotation()*pInitialPose->se3WfromC.get_rotation()).ln()) > pInitialPose->dMaxRotationError)
              continue;
          }
 		      hypotheses.push_back(h);
        }
	    }
    }

    unsigned int groups = 0, blocks = 0, start_index = 0, preemptive_reduction = hypotheses.size();
    const unsigned int total_req = nNumBlocks*nGroupsPerBlock*nGroupSize;
    while(blocks < nNumBlocks)
    {
      // Select group of test observations first
      std::vector<Observation*> vObservationGroup;
      if(total_req > nNumObs)
      {
        unsigned int end_index = std::min(vObservations.size(), start_index + nGroupSize);
        for(unsigned int i = start_index; i < end_index; ++i)
          vObservationGroup.push_back(vObservations[i]);
        start_index = end_index;
      }
      else
      {
	      for(unsigned int req = nGroupSize; req > 0; req--)
        {
	        //Select unique observations like drawing tickets from a lottery. Equal chance of winning (N/M), but each time a non-winning ticket is drawn
	        //probability changes to N/(M-1) and each time winning ticket drawn probability changes to (N-1)/(M-1)
          while((rand() % (nNumObs-start_index)) >= req){ start_index++; }
          vObservationGroup.push_back(vObservations[start_index++]);
        }
      }

		  // Compute the Cauchy probability for each hypothesis given the group of observations
		  for(unsigned int hypo = 0; hypo < preemptive_reduction; hypo++)
      {
        hypotheses[hypo].dError += caucyError(hypotheses[hypo].se3CfromW, vObservationGroup);
        hypotheses[hypo].nErrorPoints += vObservationGroup.size();
      }

      // If we have run out of observations to process sort according to current score and return
      if(start_index == nNumObs)
      {
        std::partial_sort(hypotheses.begin(), hypotheses.begin()+1, hypotheses.end());
        break;
      }

		  // If it is a preemptive iteration
		  if(groups == nGroupsPerBlock)
		  {
			  //Reorder the hypotheses according to there scores and reduce the number of hypotheses
			  preemptive_reduction = floor(preemptive_reduction/2);

			  std::partial_sort(hypotheses.begin(), hypotheses.begin()+preemptive_reduction, hypotheses.end());

        // Check we have more than one hypothesis remaining
        if(preemptive_reduction == 1)
          break;

 			  hypotheses.erase(hypotheses.begin()+preemptive_reduction, hypotheses.end());

        ++blocks;
        groups = 0;
		  }
	  }

    if(!hypotheses.empty())
    {
	    bestPose = hypotheses[0];
      if(isnan(bestPose.dError))
        bSolution = false;
      else
      	bSolution = true;

      hypotheses.clear();
    }
  }

  delete comb;
  return bSolution;
}



//Input: Pts_world (3 x 4) 3D positions of 4 points in the world axis, Pts_vec (3 x 4) calibrated point positions in image (must be unit length vector)
//Output: R (3 x 3) and T (3 x 1) camera absolute rotation matrix and translation vector, and reprojection error 'score'
bool PoseEstimator::threePointAbsolute(const std::vector<Observation*> &vObservations, PoseHypothesis &hyp, bool bRelativeToCamPos)
{
  bool found_solution = false;
 	hyp.dError = std::numeric_limits<double>::max();

  double roots[3], coeff[4];

  Vector<3> v3Diff12, v3Diff02, v3Diff01;
  if(bRelativeToCamPos)
  {
    v3Diff12 = vObservations[1]->v3CamPos - vObservations[2]->v3CamPos;
    v3Diff02 = vObservations[0]->v3CamPos - vObservations[2]->v3CamPos;
    v3Diff01 = vObservations[0]->v3CamPos - vObservations[1]->v3CamPos;
  }
  else
  {
    v3Diff12 = vObservations[1]->v3WorldPos - vObservations[2]->v3WorldPos;
    v3Diff02 = vObservations[0]->v3WorldPos - vObservations[2]->v3WorldPos;
    v3Diff01 = vObservations[0]->v3WorldPos - vObservations[1]->v3WorldPos;
  }

  double a = sqrt(v3Diff12 * v3Diff12);
  double b = sqrt(v3Diff02 * v3Diff02);
  double c = sqrt(v3Diff01 * v3Diff01);
	double a2 = a*a, b2 = b*b, c2 = c*c;

	double alpha = acos(vObservations[1]->v3Ray * vObservations[2]->v3Ray);
  double beta = acos(vObservations[0]->v3Ray * vObservations[2]->v3Ray);
  double gamma = acos(vObservations[0]->v3Ray * vObservations[1]->v3Ray);
	double sin2alpha = pow(sin(alpha),2);
  double sin2beta = pow(sin(beta),2);
  double sin2gamma = pow(sin(gamma),2);

	coeff[0] = c2*(c2*sin2beta - b2*sin2gamma);
	coeff[1] = b2*(b2 - a2)*sin2gamma + c2*(c2 + 2*a2)*sin2beta + 2*b2*c2*(-1 + cos(alpha)*cos(beta)*cos(gamma));
 	coeff[2] = b2*(b2 - c2)*sin2alpha + a2*(a2 + 2*c2)*sin2beta + 2*a2*b2*(-1 + cos(alpha)*cos(beta)*cos(gamma));
	coeff[3] = a2*(a2*sin2beta - b2*sin2alpha);
  solveCubic(coeff, roots);

	double lambda0 = roots[0];
	double A = 1 + lambda0;
	double B = -cos(alpha);
	double C = (b2 - a2)/b2 - lambda0*(c2/b2);
	double D = -lambda0*cos(gamma);
	double E = (a2/b2 + lambda0*(c2/b2))*cos(beta);
	double F = -a2/b2 + lambda0*((b2 - c2)/b2);

	double p = sqrt(B*B - A*C);
	double q = sign(B*E - C*D)*sqrt(E*E - C*F);
	double m[2] = {(-B + p)/C, (-B - p)/C};
	double n[2] = {-(E - q)/C, -(E + q)/C};
	double u[2];

  // Compute centroid of the first three world points and remove centroid from the points
  Vector<3> v3Centroid, v3Pos0, v3Pos1, v3Pos2;
  if(bRelativeToCamPos)
  {
    v3Centroid = (vObservations[0]->v3CamPos + vObservations[1]->v3CamPos + vObservations[2]->v3CamPos)/3;
    v3Pos0 = vObservations[0]->v3CamPos - v3Centroid;
    v3Pos1 = vObservations[1]->v3CamPos - v3Centroid;
    v3Pos2 = vObservations[2]->v3CamPos - v3Centroid;
  }
  else
  {
    v3Centroid = (vObservations[0]->v3WorldPos + vObservations[1]->v3WorldPos + vObservations[2]->v3WorldPos)/3;
    v3Pos0 = vObservations[0]->v3WorldPos - v3Centroid;
    v3Pos1 = vObservations[1]->v3WorldPos - v3Centroid;
    v3Pos2 = vObservations[2]->v3WorldPos - v3Centroid;
  }

	for(unsigned int i = 0; i < 2; i++)
	{
		double G = b2 - m[i]*m[i]*c2;
		double H = m[i]*c2*(cos(beta) - n[i]) - b2*cos(gamma);
		double I = -c2*n[i]*n[i] + 2*c2*n[i]*cos(beta) + b2 - c2;

		u[0] = -sign(H)/G * (fabs(H) + sqrt(H*H - G*I));
		u[1] = I/(G*u[0]);

		for(unsigned int j = 0; j < 2; j++)
		{
			if(u[j] >= 0)
			{
				double s1 = sqrt(c2/(1 + u[j]*u[j] - 2*u[j]*cos(gamma)));
				if(s1 >= 0)
				{
					double v = u[j]*m[i] + n[i];
					if(v >= 0)
					{
            //Scale ray vectors to obtain point positions in camera coordinate system (without modifying ray values as need again in next loop)
            Vector<3> v3CamPos0 = vObservations[0]->v3Ray;
            v3CamPos0 *= s1;
            Vector<3> v3CamPos1 = vObservations[1]->v3Ray;
            v3CamPos1 *= u[j]*s1;
            Vector<3> v3CamPos2 = vObservations[2]->v3Ray;
            v3CamPos2 *= v*s1;

            // Compute centroid of the three points and remove centroid from the points
            Vector<3> v3CamCentroid = v3CamPos0 + v3CamPos1 + v3CamPos2;
            v3CamCentroid /= 3;
            v3CamPos0 -= v3CamCentroid;
            v3CamPos1 -= v3CamCentroid;
            v3CamPos2 -= v3CamCentroid;

             // M = Sum_i (pw_i' pc_i'^T)
            Matrix<3,3> M = v3Pos0.as_col() * v3CamPos0.as_row();
            M += v3Pos1.as_col() * v3CamPos1.as_row();
            M += v3Pos2.as_col() * v3CamPos2.as_row();
            SVD<3,3> svd(M);

            PoseHypothesis test;

            //R = V*U^T
            test.se3CfromW.get_rotation() = svd.get_VT().T() * svd.get_U().T();

            if(determinant(test.se3CfromW.get_rotation()) < 0) // If determinant < 0 negate 3rd column of V?
            {
					    svd.get_VT()(2,0) = -svd.get_VT()(2,0);
					    svd.get_VT()(2,1) = -svd.get_VT()(2,1);
					    svd.get_VT()(2,2) = -svd.get_VT()(2,2);

              test.se3CfromW.get_rotation() = svd.get_VT().T() * svd.get_U().T();
            }

            //t = pcm - R*pwm
            test.se3CfromW.get_translation() = v3CamCentroid - test.se3CfromW.get_rotation() * v3Centroid;

            //! Compute reprojection error in squared pixel distance, and convert to cauchy error
            test.nErrorPoints = 1;
            if(bRelativeToCamPos)
              test.dError = log(1 + squaredProjectionError(test.se3CfromW, vObservations[3]->v3CamPos, vObservations[3]->v2ImagePos));
            else
              test.dError = log(1 + squaredProjectionError(test.se3CfromW, vObservations[3]->v3WorldPos, vObservations[3]->v2ImagePos));

						if(test.dError < hyp.dError)
            {
							hyp = test;
							found_solution = true;							
						}
					}
				}
			}
		}
	}

	return found_solution;
}

double PoseEstimator::squaredProjectionError(const SE3<> &se3CfromW, const Vector<3> &v3WorldPos, const Vector<2> &v2ImagePos)
{
  // Find projected image pixel position given computed pose
  Vector<3> v3CamPos = se3CfromW * v3WorldPos;
  Vector<2> v2ProjectedPos = mCamera.Project(project(v3CamPos));

  //! Compute reprojection error in squared pixel distance
  return(pow(v2ImagePos[0]-v2ProjectedPos[0],2) + pow(v2ImagePos[1]-v2ProjectedPos[1],2));
}

double PoseEstimator::caucyError(const SE3<> &se3CfromW, const std::vector<Observation*> &obs)
{
  double cauchyError = 1;

  for(unsigned int i = 0; i < obs.size(); ++i)
  {
    // Project to image pixel position
    Vector<3> v3ImPlane = se3CfromW * obs[i]->v3WorldPos;
    v3ImPlane /= v3ImPlane[2];
    Vector<2> v2ImagePos = mCamera.Project(project(v3ImPlane));

    //! Compute reprojection error in squared pixel distance
    double error = pow(obs[i]->v2ImagePos[0]-v2ImagePos[0],2) + pow(obs[i]->v2ImagePos[1]-v2ImagePos[1],2);
    cauchyError *= (1 + error);
  }

  return log(cauchyError);
}

void PoseEstimator::solveCubic(double (&coeffs)[4], double (&roots)[3])
{
  int n = 0;
  double x0 = 0.0, x1 = 0.0, x2 = 0.0;
  double a0 = coeffs[0];
  double a1 = coeffs[1];
  double a2 = coeffs[2];
  double a3 = coeffs[3];

  if( a0 == 0 )
  {
    if( a1 == 0 )
    {
      if( a2 == 0 )
        n = a3 == 0 ? -1 : 0;
      else
      {
        // linear equation
        x0 = a3/a2;
        n = 1;
      }
    }
    else
    {
      // quadratic equation
      double d = a2*a2 - 4*a1*a3;
      if( d >= 0 )
      {
        d = sqrt(d);
        double q = (-a2 + (a2 < 0 ? -d : d)) * 0.5;
        x0 = q / a1;
        x1 = a3 / q;
        n = d > 0 ? 2 : 1;
      }
    }
  }
  else
  {
    a0 = 1./a0;
    a1 *= a0;
    a2 *= a0;
    a3 *= a0;

    double Q = (a1 * a1 - 3 * a2) * (1./9);
    double R = (2 * a1 * a1 * a1 - 9 * a1 * a2 + 27 * a3) * (1./54);
    double Qcubed = Q * Q * Q;
    double d = Qcubed - R * R;

    if( d >= 0 )
    {
      double theta = acos(R / sqrt(Qcubed));
      double sqrtQ = sqrt(Q);
      double t0 = -2 * sqrtQ;
      double t1 = theta * (1./3);
      double t2 = a1 * (1./3);
      x0 = t0 * cos(t1) - t2;
      x1 = t0 * cos(t1 + (2.*M_PI/3)) - t2;
      x2 = t0 * cos(t1 + (4.*M_PI/3)) - t2;
      n = 3;
    }
    else
    {
      double e;
      d = sqrt(-d);
      e = pow(d + fabs(R), 0.333333333333);
      if( R > 0 )
        e = -e;
      x0 = (e + Q / e) - a1 * (1./3);
      n = 1;
    }
  }

  roots[0] = x0;
  roots[1] = x1;
  roots[2] = x2;
}

double PoseEstimator::determinant(const SO3<> &so3)
{
  const Matrix<3,3> &m = so3.get_matrix();
  return( m(0,0)*m(1,1)*m(2,2) + m(0,1)*m(1,2)*m(2,0) + m(0,2)*m(1,0)*m(2,1) - m(0,0)*m(1,2)*m(2,1) - m(0,1)*m(1,0)*m(2,2) - m(0,2)*m(1,1)*m(2,0) );
}

Matrix<3,3> PoseEstimator::matrixCrossProduct(Vector<3> v3A)
{
  Matrix<3,3> m33;

  m33(0,0) = 0.0;
  m33(0,1) = -v3A[2];
  m33(0,2) = v3A[1];
  m33(1,0) = v3A[2];
  m33(1,1) = 0.0;
  m33(1,2) = -v3A[0];
  m33(2,0) = -v3A[1];
  m33(2,1) = v3A[0];
  m33(2,2) = 0.0;
  
  return m33;
}

void PoseEstimator::runtest()
{
  const int nNumPts = 40;

  TooN::Matrix<3,3> m33R0; 
  TooN::Fill(m33R0) = -8.716549e-01,-4.901201e-01,-1.224647e-16,-4.562006e-01,8.113307e-01,3.655456e-01,-1.791613e-01,3.186297e-01,-9.307934e-01;
  TooN::Vector<3> v3T0 = TooN::makeVector(3.111365e+01,-2.356513e+01,3.846035e+00);
  TooN::SE3<> se3C0fromW = SE3<>(m33R0, v3T0);

  TooN::Matrix<3,3> m33R1; 
  TooN::Fill(m33R1) = -8.746923e-01,-4.846786e-01,-1.224647e-16,-4.468809e-01,8.064792e-01,3.871547e-01,-1.876456e-01,3.386412e-01,-9.220148e-01;
  TooN::Vector<3> v3T1 = TooN::makeVector(3.098094e+01,-2.478158e+01,3.205932e+00);
  TooN::SE3<> se3C1fromW = SE3<>(m33R1, v3T1);

  TooN::Matrix<3,3> m33R2;
  TooN::Fill(m33R2) = -8.813486e-01,-4.724665e-01,-1.224647e-16,-4.320946e-01,8.060380e-01,4.044712e-01,-1.910991e-01,3.564801e-01,-9.145507e-01;
  TooN::Vector<3> v3T2 = TooN::makeVector(3.066883e+01,-2.617605e+01,2.553078e+00);
  TooN::SE3<> se3C2fromW = SE3<>(m33R2, v3T2);

  TooN::Matrix<nNumPts,3> mv3PtsWorld;
  TooN::Fill(mv3PtsWorld) = 16.4907800000000,40.7528600000000,2.47289100000000, 11.4715600000000,35.7647600000000,3.15098300000000, 13.6801800000000,35.6983700000000,3.42930000000000, 17.3873100000000,38.8433300000000,3.45195400000000, 10.2937000000000,36.8837100000000,2.99962300000000, 16.3572300000000,38.6752200000000,3.45108500000000, 12.9413900000000,36.0314000000000,3.35908000000000, 13.2962900000000,37.1642400000000,3.34447300000000, 16.8292500000000,41.4492400000000,2.49700900000000, 15.8396200000000,39.6242600000000,3.42263700000000, 17.4772400000000,37.7618100000000,3.46940500000000, 17.5546100000000,39.9751700000000,3.40530700000000, 12.3899200000000,37.7092500000000,3.22363600000000, 14.6615700000000,36.8859600000000,3.46511700000000, 13.0314800000000,35.5544500000000,3.35908000000000, 14.0505600000000,37.9517900000000,3.39731800000000, 15.8513300000000,41.1245600000000,2.47289100000000, 14.6074600000000,37.9617400000000,3.44805500000000, 10.4400900000000,37.5548900000000,2.97261300000000, 14.3298700000000,37.3145100000000,3.41747600000000, 12.2102300000000,35.1507000000000,2.53662100000000, 13.1872900000000,36.3261000000000,3.35908000000000, 14.6022000000000,37.2947600000000,3.46511700000000, 17.0954100000000,38.7650100000000,3.45195400000000, 16.7797900000000,40.5210800000000,2.49700900000000, 12.1478000000000,37.7792500000000,3.22363600000000, 17.3371300000000,41.0819700000000,2.49700900000000, 15.7885300000000,36.7728000000000,3.48589200000000, 10.3965400000000,37.5289200000000,2.97261300000000, 16.2619400000000,39.1939100000000,3.45108500000000, 17.1625100000000,38.3375800000000,3.46940500000000, 17.0712900000000,37.2153100000000,3.47917200000000, 14.2090200000000,36.7588800000000,3.41747600000000, 14.9970300000000,39.1440300000000,3.42339200000000, 16.8692100000000,39.5792800000000,3.42720400000000, 14.8390500000000,38.1665500000000,3.44805500000000, 16.2859700000000,37.9783700000000,3.47233000000000, 13.9939800000000,35.7798900000000,3.42930000000000, 14.5456600000000,36.5671700000000,3.46511700000000, 17.4624100000000,38.5879300000000,3.45195400000000;

  //Compute relative poses
  TooN::SE3<> se3C1fromC0 = se3C1fromW * se3C0fromW.inverse();
  TooN::SE3<> se3C2fromC0 = se3C2fromW * se3C0fromW.inverse();

  //Compute essential matrix from relative rotation and translation
  TooN::Matrix<3,3> m33E10 = se3C1fromC0.get_rotation() * matrixCrossProduct(se3C1fromC0.get_translation());
  TooN::Matrix<3,3> m33E20 = se3C2fromC0.get_rotation() * matrixCrossProduct(se3C2fromC0.get_translation());

  std::vector<Observation*> vObservations0, vObservations1, vObservations2;

  for(int i = 0; i < nNumPts; ++i)
  {
    Observation *obs0 = new Observation;
    obs0->v3WorldPos = mv3PtsWorld[i];
    obs0->v3CamPos = se3C0fromW * obs0->v3WorldPos;
    obs0->v2ImagePos = addPixelNoise(mCamera.Project(project(obs0->v3CamPos)));
    obs0->v3Ray = unit(unproject(mCamera.UnProject(obs0->v2ImagePos)));
    vObservations0.push_back(obs0);

    Observation *obs1 = new Observation;
    obs1->v3WorldPos = mv3PtsWorld[i];
    obs1->v3CamPos = se3C1fromW * obs1->v3WorldPos;
    obs1->v2ImagePos = addPixelNoise(mCamera.Project(project(obs1->v3CamPos)));
    obs1->v3Ray = unit(unproject(mCamera.UnProject(obs1->v2ImagePos)));
    vObservations1.push_back(obs1);

    Observation *obs2 = new Observation;
    obs2->v3WorldPos = mv3PtsWorld[i];
    obs2->v3CamPos = se3C2fromW * obs2->v3WorldPos;
    obs2->v2ImagePos = addPixelNoise(mCamera.Project(project(obs2->v3CamPos)));
    obs2->v3Ray = unit(unproject(mCamera.UnProject(obs2->v2ImagePos)));
    vObservations2.push_back(obs2);
  }

  std::cout << "Triangulation: " << std::endl;
  Vector<3> v3Cam0 = ReprojectPoint(se3C2fromC0, mCamera.UnProject(vObservations2[0]->v2ImagePos), mCamera.UnProject(vObservations0[0]->v2ImagePos));
  std::cout << "True point position " << se3C0fromW * mv3PtsWorld[0] << std::endl;
  std::cout << "Estimated point position " << v3Cam0 << std::endl;
  std::cout << "-----------------------" << std::endl;

  TooN::Matrix<9,10> mv9E;
  int nNumSolutions = 0;
 // fivePointRelative(vObservations0, vObservations2, mv9E, nNumSolutions);
  std::cout << "Five point relative pose: " << std::endl;
  std::cout << "True relative rotation " << std::endl << se3C2fromC0.get_rotation() << std::endl;
  std::cout << "True relative translation " << std::endl << unit(se3C2fromC0.get_translation()) << std::endl;
  for(int i = 0; i < nNumSolutions; i++)
  {
    Matrix<9,1> m91E = mv9E.slice(0,i,9,1);
    Matrix<3,3> m33E;
    evecToMat(m91E, m33E20);
    SE3<> se3T20;
    extractRt(m33E20, vObservations0[0], vObservations2[0], se3T20);
    std::cout << "Estimated relative rotation " << std::endl << se3T20.get_rotation() << std::endl;
    std::cout << "Estimated relative translation " << std::endl << unit(se3T20.get_translation()) << std::endl;
  }
  std::cout << "-----------------------" << std::endl;

  std::cout << "Three point absolute pose: " << std::endl;
  PoseHypothesis h3p;
	threePointAbsolute(vObservations0, h3p);
  std::cout << "Rotation: " << std::endl << se3C0fromW.get_rotation() << std::endl << h3p.se3CfromW.get_rotation() << std::endl;
  std::cout << "Translation: " << std::endl << se3C0fromW.get_translation() << std::endl << h3p.se3CfromW.get_translation() << std::endl;
  std::cout << "Error: " << h3p.dError << std::endl;
  std::cout << "-----------------------" << std::endl;

  std::cout << "Three point absolute pose RANSAC: " << std::endl;
  PoseHypothesis h3pr;
	threePointAbsoluteRANSAC(500, 50, 10, 10, vObservations0, h3pr);
  std::cout << "Rotation " << std::endl << se3C0fromW.get_rotation() << std::endl << h3pr.se3CfromW.get_rotation() << std::endl;
  std::cout << "Translation " << std::endl << se3C0fromW.get_translation() << std::endl << h3pr.se3CfromW.get_translation() << std::endl;
  std::cout << "Error: " << h3pr.dError << std::endl;
  std::cout << "-----------------------" << std::endl;

  std::cout << "Three view relative pose: " << std::endl;
  ThreeViewHypothesis h3v;
  threeViewRelative(vObservations0, vObservations1, vObservations2, h3v);
  std::cout << "Rotation C2 from C0" << std::endl << se3C2fromC0.get_rotation() << std::endl << h3v.se3T20.get_rotation() << std::endl;
  std::cout << "Translation C2 from C0" << std::endl << unit(se3C2fromC0.get_translation()) << std::endl << unit(h3v.se3T20.get_translation()) << std::endl;
  std::cout << "Rotation C1 from C0" << std::endl << se3C1fromC0.get_rotation() << std::endl << h3v.se3T10.get_rotation() << std::endl;
  std::cout << "Translation C1 from C0" << std::endl << unit(se3C1fromC0.get_translation()) << std::endl << unit(h3v.se3T10.get_translation()) << std::endl;
  std::cout << "Error: " << h3v.dError << std::endl;
  std::cout << "-----------------------" << std::endl;

  std::cout << "Three view relative pose RANSAC: " << std::endl;
  ThreeViewHypothesis h3vr;
  threeViewRelativeRANSAC(500, 500, 50, vObservations0, vObservations1, vObservations2, h3vr);
  std::cout << "Rotation C2 from C0" << std::endl << se3C2fromC0.get_rotation() << std::endl << h3vr.se3T20.get_rotation() << std::endl;
  std::cout << "Translation C2 from C0" << std::endl << unit(se3C2fromC0.get_translation()) << std::endl << unit(h3vr.se3T20.get_translation()) << std::endl;
  std::cout << "Rotation C1 from C0" << std::endl << se3C1fromC0.get_rotation() << std::endl << h3vr.se3T10.get_rotation() << std::endl;
  std::cout << "Translation C1 from C0" << std::endl << unit(se3C1fromC0.get_translation()) << std::endl << unit(h3vr.se3T10.get_translation()) << std::endl;
  std::cout << "Error: " << h3vr.dError << std::endl;
  std::cout << "-----------------------" << std::endl;

  std::cout << "Trifocal sampson error: " << std::endl;
  ThreeViewHypothesis h3e;
  h3e.m33E20 = m33E20;
  h3e.se3T20 = se3C2fromC0; 
  h3e.se3T10 = se3C1fromC0;
  h3e.computeTrifocalTensor();
  h3e.dError = 0.0;
  for(int i = 0; i < nNumPts; ++i)
    h3e.dError += computeTrifocalSampsonError(h3e, vObservations0[i], vObservations1[i], vObservations2[i]);
  std::cout << "Error: " << h3e.dError << std::endl;
  std::cout << "-----------------------" << std::endl;
}

Vector<2> PoseEstimator::addPixelNoise(const Vector<2>& imframe)
{
  const double dOutlierProbability = 0.0;
  const double dOutlierSigma = 10.0;
  const double dNoiseSigma = 0.0;
  double fac, r, v1, v2;
  bool bIsOutlier = (double)rand()/RAND_MAX < dOutlierProbability;

  do 
  {
    v1 = (2.0 * (double)rand()/RAND_MAX) - 1.0;
    v2 = (2.0 * (double)rand()/RAND_MAX) - 1.0;
    r = (v1*v1) + (v2*v2);
  } 
  while (r >= 1.0);

  fac = sqrt(-2.0 * log(r) / r);

  if(bIsOutlier)
    return makeVector(imframe[0] + dOutlierSigma*v1*fac, imframe[1] + dOutlierSigma*v2*fac);
  else
    return makeVector(imframe[0] + dNoiseSigma*v1*fac, imframe[1] + dNoiseSigma*v2*fac);
}  


